#include <arch/types.h>


static __VOLATILE__ UINT32 gTickCount = 1;


void GuIncTick(void)
{
	gTickCount++;
}

UINT32 GuGetTick(void)
{
	return gTickCount;
}


void mdelay(ULONG n)
{
	__VOLATILE__ ULONG Cur = GuGetTick();


	// yes, we'd write the loop in this way :P
	while (1)
	{
		if (GuGetTick() >= Cur + n)
			return;
	}
}

